package com.csaba.connector.axa;

import com.csaba.connector.DummyServer;
import com.csaba.connector.ServiceException;
import com.csaba.connector.axa.model.AXABank;
import com.csaba.connector.axa.model.AXASession;
import com.csaba.connector.model.Session;
import com.csaba.connector.service.AbstractBankService;
import com.csaba.connector.service.LogoutService;

public class AXALogoutService extends AbstractBankService implements LogoutService, Codes
{

	@Override
	public void execute( final Session session ) throws ServiceException
	{
		if ( !( session instanceof AXASession ) )
			throw new ServiceException("Incompatible session " + AXABank.class + " != " + session.getClass().getName());

		final AXASession axa = (AXASession) session;

		DummyServer.getInstance().removeSession(session);

		//logout
		final String logoutResult = axa.doGet(AXASession.getRequestURL(REQUEST_LOGOUT));
		axa.debugFile("logoutResult", logoutResult);
	}

}
